# Contributor: Hazem <hazem-alpine@riseup.net>
# Maintainer: Hazem <hazem-alpine@riseup.net>
pkgname=massivethreads
pkgver=1.00
pkgrel=0
pkgdesc="Lightweight Thread Library for High Productivity Languages"
url="https://github.com/massivethreads/massivethreads"
arch="x86_64"
license="BSD-2-Clause"
makedepends="autoconf automake"
subpackages="$pkgname-dev"
source="
	https://github.com/massivethreads/massivethreads/archive/refs/tags/v$pkgver/massivethreads-$pkgver.tar.gz
	0001-musl-fixes.patch
"

build() {
	aclocal # needed because we patch Makefile.ac
	automake -a
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-myth-dl \
		--disable-myth-ld
	make
}

check() {
	# pvalloc is not implemented in musl and not needed in massivethreads
	# only referenced for wrapping in myth-dl/ld which we disable anyway
	echo 'main(){}' > $builddir/tests/myth_pvalloc.c
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	rm -f $pkgdir/usr/bin/*
	rm -f $pkgdir/usr/lib/libdr*
}

sha512sums="
aaea978bf0d41a9a97ccf0d8c5be318feb1e547e72f7dea267ddc3a18d653831465d531c193f79e8f75d75b12945d3dab882d93596d90dda7f70676fe87ea72e  massivethreads-1.00.tar.gz
6e45f1053580460bf203c4e92e9889a3d7a46adfc4d38b4e75eaab8b73c3992fc928f6ff94960e7cb00bbc02fb61b6ab4646daf7051f69166780b62eb6ba5a5f  0001-musl-fixes.patch
"
